package com.lgj.auth.code.handler.exception;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.security.oauth2.common.exceptions.OAuth2Exception;
import org.springframework.security.oauth2.provider.error.DefaultWebResponseExceptionTranslator;
import org.springframework.security.oauth2.provider.error.WebResponseExceptionTranslator;
import org.springframework.stereotype.Component;

/**
 * 用户密码错误异常处理器
 * @author guangjie.liao
 **/
@Component
public class AuthTokenExceptionHandler implements WebResponseExceptionTranslator<OAuth2Exception> {

    private static final Logger logger = LoggerFactory.getLogger(AuthTokenExceptionHandler.class);

    @Override
    public ResponseEntity<OAuth2Exception> translate(Exception e) throws Exception {
        return new DefaultWebResponseExceptionTranslator().translate(e);
    }

}
